<?php
header('Content-Type:text/html; charset=UTF-8');
session_start();
if (empty($_SESSION['user'])) {
    header('location:dl.php');
    exit();
}
@$ddid = $_REQUEST['ddid'];
$pdo = new PDO('mysql:dbname=dcxt;charset=utf8', 'root');
if ($ddid != null) {
    $s6 = $pdo->prepare('delete from dingdan where dingdan.id=:sccz');
    $s6->execute(array(
        'sccz' => $ddid
    ));
}
?>
<html>
<head>
<title>Bootstrap 模板</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
	charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="web/css/bootstrap.min.css" rel="stylesheet">
<script src="web/js/jquery-1.11.1.min.js"></script>
<script src="web/js/bootstrap.min.js"></script>
<!--[if lt IE 9]>
		<script src="js/html5shiv.js"></script>
		<script src="js/respond.min.js"></script>
		<![endif]-->
</head>
<body>
	<?php include 'dh.php'; ?>
	<div class="container">
		<div class="col-xs-2">
			<a href="ddlb.php" class="btn btn-default btn-block">订单列表</a>
			<a href="dcxt.php" class="btn btn-default btn-block">返回首页</a>
		</div>
		<div class="col-xs-10">
			<div class="panel panel-primary">
				<div class="panel-heading">
					<div class="panel-lilte">
						<span class="glyphicon glyphicon-list">
							<b>订单历史记录列表</b>
						</span>
					</div>
				</div>
				<table class="table table-bordered table-hover">
					<tr>
						<th>餐桌[状态]</th>
						<th>生成日期</th>
						<th>金额</th>
						<th>操作</th>
					</tr>
					<?php
                        $s = $pdo->prepare('select * from dingdan join cz on dingdan.czzid = cz.id ');
                        $s->execute();
                        $data = $s->fetchAll(PDO::FETCH_NAMED);
                        foreach ($data as $value) {
                            ?>			
					<tr>
						<td><?php echo $value['czm']?><span style="color: #8B3A3A">[<?php echo $value['zt']?>]</span>
						</td>
						<td><?php echo $value['scsj']?></td>
						<td><?php echo $value['je']?></td>
						<td>
							<?php if ($value['zt']=="待付款"){
							    ?>
							    <a href="zhifu.php?ddid=<?php echo $value['id'][0] ?>">结帐</a><?php 
							}else{
							    echo "结帐";
							}?>
							<a href="ddjl.php?ddid=<?php echo $value['id'][0] ?>" data-toggle="modal">删除</a>
						</td>
					</tr>
					<?php }?>		
				</table>
				<?php foreach ($data as $value) { ?>
				
					<div id=""></div>
				<?php }?>
			</div>
		</div>
	</div>
</body>
</html>

